package com.ymatou.query.trading.api.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetBuyerPostpayOrderNumBean;
import com.ymatou.query.trading.api.service.GetBuyerPostpayOrderNumCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.constant.ECode;

/**
 * 获取买家补款中订单数量 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetBuyerPostpayOrderNum {

	private static GetBuyerPostpayOrderNumBean getbuyerpostpayordernumbean;
	private static GetBuyerPostpayOrderNumCall getbuyerpostpayordernumcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取买家补款中订单数量");
	}

	@Before
	public void caseUp() {

		getbuyerpostpayordernumbean = new GetBuyerPostpayOrderNumBean();
		getbuyerpostpayordernumcall = new GetBuyerPostpayOrderNumCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getbuyerpostpayordernumcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetBuyerPostpayOrderNum_001() {
		Logger.start(true,"获取买家补款中订单数量成功");
		try {
			// 参数
			int BuyerId = 1113;
			getbuyerpostpayordernumbean.setBuyerId(BuyerId);
			// 发送请求
			getbuyerpostpayordernumcall.setData(getbuyerpostpayordernumbean);
			getbuyerpostpayordernumcall.callService();
			Logger.comment("getbuyerpostpayordernumcall send:" + getbuyerpostpayordernumcall.getEntityString());
			Logger.comment("getbuyerpostpayordernumcall response:" + getbuyerpostpayordernumcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getbuyerpostpayordernumcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getbuyerpostpayordernumcall.getMsg(), "验证Msg");
			Logger.verifyEquals(true, getbuyerpostpayordernumcall.getOrderNum() > 0, "验证查询结果长度");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetBuyerPostpayOrderNum_002() {
		Logger.start(true,"用户不存在");
		try {
			// 参数
			int BuyerId = 1;
			getbuyerpostpayordernumbean.setBuyerId(BuyerId);
			// 发送请求
			getbuyerpostpayordernumcall.setData(getbuyerpostpayordernumbean);
			getbuyerpostpayordernumcall.callService();
			Logger.comment("getbuyerpostpayordernumcall send:" + getbuyerpostpayordernumcall.getEntityString());
			Logger.comment("getbuyerpostpayordernumcall response:" + getbuyerpostpayordernumcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getbuyerpostpayordernumcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getbuyerpostpayordernumcall.getMsg(), "验证Msg");
			Logger.verifyEquals(0, getbuyerpostpayordernumcall.getOrderNum(), "验证查询结果长度");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetBuyerPostpayOrderNum_003() {
		Logger.start(true,"用户为空");
		try {
			// 参数
			// getbuyerpostpayordernumbean.setBuyerId(BuyerId);
			// 发送请求
			getbuyerpostpayordernumcall.setData(getbuyerpostpayordernumbean);
			getbuyerpostpayordernumcall.callService();
			Logger.comment("getbuyerpostpayordernumcall send:" + getbuyerpostpayordernumcall.getEntityString());
			Logger.comment("getbuyerpostpayordernumcall response:" + getbuyerpostpayordernumcall.getReturnData());
			Logger.verifyEquals(ECode.ERROR500, getbuyerpostpayordernumcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getbuyerpostpayordernumcall.getMsg(), "验证Msg");
			// Logger.verifyEquals(0, getbuyerpostpayordernumcall.getOrderNum(),
			// "验证查询结果长度");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

}